<template>
<div class="wrap">
<xcl-header :page-title="pageTitle" :header-right="headerRight"></xcl-header>
<div class="content">
	<div class="list-block" style="margin:0;" v-if="!faild">
	    <ul>
	      <li class="item-content">
	        <div class="item-inner">
	          <div class="item-title">真是姓名</div>
	          <div class="item-after">{{user.trueName | hideNumber -1 1}}</div>
	        </div>
	      </li>
	      <li class="item-content">
	        <div class="item-inner">
	          <div class="item-title">身份证号</div>
	          <div class="item-after">{{ user.idNumber | hideNumber 1 15 }}</div>
	        </div>
	      </li>
	      <li class="item-content">
	        <div class="item-inner">
	          <div class="item-title">银行卡</div>
	           <div class="item-after">{{user.cardName}}（尾号{{ user.cardNumber}}）</div>
	        </div>
	      </li>
	    </ul>
	</div>
	<div class="list-block" style="margin:0;background:#fff;padding:0.5rem;" v-if="faild">
	    <p>
	    	购买私募产品，需要认证身份信息、银行卡信息，并上传证件照片，由于认证过程较为复杂，请前往新策略网站完成认证过程。
	    </p>
	    <p>
	    	新策略网址：	<br />
	    	www.58xcl.com    	
	    </p>
	</div>
</div>
  </div>
</template>
<script>
import {getCheck,ERROR_DEFINE}  from '../libs/utils'
import xclHeader from '../components/header.vue'
let UserProxy =  require("../proxy/user_proxy");
let User = new UserProxy();
export default {
    data (){
        return {
            scroll:true,
            pageTitle:'认证信息',
            submitText:'确定',
            headerRight:'', 
            faild:false,
            user:{
            	trueName:'',
            	idNumber:'',
            	cardNumber:'',
            	cardName:''
            }
        }
    },
    ready(){
        console.log(this.$parent)
    	this.login();
    },
    methods:{
    	login(){
    		var _this = this;
    		if(localStorage.authentication==0){
    			_this.faild = true;
    			return;
    		}
    		User.getUserDetail(localStorage.token,(d)=>{
    			// debugger;
    			if(d.code == 200 &&d.results && d.results.length){
    				_this.user.trueName = d.results[0].n;
    				_this.user.idNumber = d.results[0].idn;
    			}else if(d.code == 4090){
                      localStorage.removeItem('token');
                      _this.$router.go('/Login'); 
                }else{
                	_this.faild = true
                }
    		});
    		User.getBindBank(localStorage.token,(d)=>{
    			if(d.code == 200 &&d.results && d.results.length){
    				_this.user.cardNumber = d.results[0].ba.slice(-4);
    				_this.user.cardName = d.results[0].b;
    			}else if(d.code == 4090){
                      localStorage.removeItem('token');
                      _this.$router.go('/Login'); 
                }else{
                	_this.faild = true
                }
    		});
    	}
    },
    components:{
       "xclHeader":xclHeader
    }
}
</script>